<template>
  <div>
    <div></div>
    <div id="main" style="width:600px;height:600px"></div>
  </div>
</template>

<script>
// 导入echarts包
import * as echarts from 'echarts'
export default {
  data() {
    return {
      option: {
        title: {
          text: '绩效指数'
        },
        legend: {
          data: ['Allocated Budget', 'Actual Spending']
        },
        radar: {
          // shape: 'circle',
          indicator: [
            { name: '销售额', max: 6500, color: 'red' },
            { name: '成本花销', max: 16000, color: 'red' },
            { name: '盈利指标', max: 30000, color: 'red' },
            { name: '考勤指标', max: 38000, color: 'red' },
            { name: '全勤指标', max: 52000, color: 'red' },
            { name: '迟到指标', max: 25000, color: 'red' }
          ]
        },
        series: [
          {
            name: 'Budget vs spending',
            type: 'radar',
            data: [
              {
                value: [4200, 3000, 20000, 35000, 50000, 18000],
                name: 'Allocated Budget'
              },
              {
                value: [5000, 14000, 28000, 26000, 42000, 21000],
                name: 'Actual Spending'
              }
            ]
          }
        ]
      }
    }
  },
  mounted() {
    // main是指定的dom元素来显示图表
    var chartDom = document.getElementById('main')
    var myChart = echarts.init(chartDom)
    this.option && myChart.setOption(this.option)
  }
}
</script>

<style></style>
